package wnhz.com.business.homemain;

import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
import wnhz.com.business.BeginActivity;
import wnhz.com.business.R;
import wnhz.com.business.base.MyBaseActivity;
import wnhz.com.business.base.MyBaseFragment;
import wnhz.com.business.freeshop.FreeShopActivity;
import wnhz.com.business.groupshop.MainActivity;
import wnhz.com.business.groupshop.ui.CreditNumActivity;
import wnhz.com.business.groupshop.ui.HelpCenterActivity;
import wnhz.com.business.groupshop.ui.MeassageChangeActivity;
import wnhz.com.business.groupshop.ui.MessageActivity;
import wnhz.com.business.rebateshop.RebateShopActivity;
import wnhz.com.business.rebateshop.activity.mine.AllOrderActivity;
import wnhz.com.business.rebateshop.activity.mine.SettingActivity;
import wnhz.com.business.shareshop.ShareShopActivity;
import wnhz.com.business.shareshop.activity.mine.DepositActivity;
import wnhz.com.business.shareshop.activity.mine.RebateActivity;
import wnhz.com.business.shareshop.activity.mine.ShareActivity;
import wnhz.com.business.shareshop.ui.CreditNumActivityS;
import wnhz.com.business.shareshop.ui.FundActivityS;
import wnhz.com.business.shareshop.ui.MakeMerchatActivityS;
import wnhz.com.business.shareshop.ui.MyAttentionActivityS;
import wnhz.com.business.shareshop.ui.MyCollectActivityS;

/**
 * Created by Administrator on 2017-12-13 0013.
 */

public class MainMyFragment extends MyBaseFragment {
    private MyBaseActivity activity;
    Unbinder unbinder;

    @BindView(R.id.iv_r_head)  //头像
            ImageView ivRHead;
    @BindView(R.id.tv_r_userName)//名字
            TextView tvRUserName;
    @BindView(R.id.tv_r_describe)//
            TextView tv_r_describe;



    @Override
    protected void handleMsg(Message msg) {
        switch (msg.what) {
            case 5001:
                break;
        }
    }

    @Override
    protected View initView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_main_my, container, false);
        activity = (MyBaseActivity) getActivity();
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        }
        return view;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        // TODO: inflate a fragment view
        View rootView = super.onCreateView(inflater, container, savedInstanceState);
        unbinder = ButterKnife.bind(this, rootView);
        loadInfo();

        return rootView;
    }

    private void loadInfo() {
        handler.sendEmptyMessage(5001);
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }

    @OnClick({R.id.iv_r_head,R.id.ll_equity, R.id.ll_share_store,R.id.ll_group_shopping_store,R.id.ll_free_store,R.id.ll_rebate_store,R.id.ll_r_setting})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.iv_r_head://个人信息头像
                startActivity(MeassageChangeActivity.createIntent(activity));
                break;
            case R.id.ll_equity://
                startActivity(new Intent(getActivity(), FreeShopActivity.class));
                break;
            case R.id.ll_share_store://
                startActivity(new Intent(getActivity(), ShareShopActivity.class));
                break;
            case R.id.ll_free_store://
                startActivity(new Intent(getActivity(), FreeShopActivity.class));
                break;
            case R.id.ll_group_shopping_store://
                startActivity(new Intent(getActivity(), MainActivity.class));

                break;
            case R.id.ll_rebate_store://
                startActivity(new Intent(getActivity(), RebateShopActivity.class));

                break;

            case R.id.ll_r_setting://设置
                startActivity(SettingActivity.createIntent(activity));
                break;
        }
    }
}